unit SmallStruct.Resource.TSSResource;

interface

uses Classes,
  SmallStruct.Core.TSSObject,
  SmallStruct.Resource;

type
  TSSResource = class(TSSObject, ISSResource)
  var
    _Buffer: TMemoryStream;
    public
  procedure SetResource(ABuffer: TStream);
private
  function GetResource: TStream;
public
  constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
  end;

implementation

{ TSSResource }

constructor TSSResource.Create(AOwner: TComponent);
begin
  inherited;
  _Buffer := TMemoryStream.Create;
end;

destructor TSSResource.Destroy;
begin
  _Buffer.Free;
  inherited;
end;

function TSSResource.GetResource: TStream;
begin
  Result := _Buffer;
end;

procedure TSSResource.SetResource(ABuffer: TStream);
begin
  _Buffer.LoadFromStream(ABuffer);
end;

end.
